package paginas;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.util.ResourceBundle;

import javax.swing.JEditorPane;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.TitledBorder;

import modelUtil.Util;
import util.BotonPersonalizado;
import AccionBoton.AccionAdjuntarAccesibilidad;

public class EditorAspectoBotonTab3 extends JPanel{

	
	
	private static final long serialVersionUID = 1L;
	private PaginaAspectoBoton _frame;
	private JPanel panel1 = new JPanel();
	private JPanel panel2 = new JPanel();
	private JLabel etiquetaName, etiquetaDescription;
	private JEditorPane panelAccessibleName,panelAccessibleDescription;
	private BotonPersonalizado adjuntar;
	
	public EditorAspectoBotonTab3(PaginaAspectoBoton frame){
		_frame = frame;
		this.setFocusable(true);
		this.setPreferredSize(new Dimension(700,400));
		initComponents();

	}
	
	public void initComponents(){
		
		GridBagLayout grid = new GridBagLayout();
		GridBagConstraints cons = new GridBagConstraints();
		setLayout(grid);
		cons.gridx = 0;
		cons.gridy = 0;
		cons.gridheight = 1;
		cons.gridwidth = 1;
		cons.fill = GridBagConstraints.BOTH;
		crearPanelArriba();
		crearPanelAbajo();

		grid.addLayoutComponent(panel1, cons);
		add(panel1);
		cons.gridy = 1;
		grid.addLayoutComponent(panel2, cons);
		add(panel2);

		
		
	}

	public void crearPanelArriba(){
		
		panel1.setPreferredSize(new Dimension(500,300));
		TitledBorder border = new TitledBorder(ResourceBundle.getBundle("internacionalizacion/Etiquetas").getString("etiqueta_pagina_aspecto_boton_accesibilidad_titulo"));
		border.setTitleFont(border.getTitleFont().deriveFont(Font.BOLD, 14));
		panel1.setBorder(border);
		panelAccessibleName = new JEditorPane();
		panelAccessibleDescription = new JEditorPane();
		panelAccessibleName.setFocusable(true);
		panelAccessibleDescription.setFocusable(true);
		panelAccessibleName.setText(_frame.get_botonTO().getAccesibleName());
		panelAccessibleDescription.setText(_frame.get_botonTO().getAccesibleDescription());


		panelAccessibleName.setPreferredSize(new Dimension(450,100));
		panelAccessibleDescription.setPreferredSize(new Dimension(450,100));
		etiquetaName = new JLabel(ResourceBundle.getBundle("internacionalizacion/Etiquetas").getString("etiqueta_pagina_aspecto_boton_accessible_name"));
		etiquetaName.setToolTipText(ResourceBundle.getBundle("internacionalizacion/Etiquetas").getString("etiqueta_accesible_aspecto_accessible_name"));
		etiquetaDescription = new JLabel(ResourceBundle.getBundle("internacionalizacion/Etiquetas").getString("etiqueta_pagina_aspecto_boton_accessible_description"));
		etiquetaDescription.setToolTipText(ResourceBundle.getBundle("internacionalizacion/Etiquetas").getString("etiqueta_accesible_aspecto_accessible_description"));
		GridBagLayout grid2 = new GridBagLayout();
		GridBagConstraints cons2 = new GridBagConstraints();
		cons2.gridx = 0;
		cons2.gridy = 0;
		cons2.gridheight = 1;
		cons2.gridwidth = 1;
		cons2.fill = GridBagConstraints.BOTH;
		panel1.setLayout(grid2);
		grid2.addLayoutComponent(etiquetaName, cons2);
		panel1.add(etiquetaName);
		cons2.gridy = 1 ;
		grid2.addLayoutComponent(panelAccessibleName, cons2);
		panel1.add(panelAccessibleName);
		cons2.gridy = 2;
		grid2.addLayoutComponent(etiquetaDescription, cons2);
		panel1.add(etiquetaDescription);
		cons2.gridy = 3;
		grid2.addLayoutComponent(panelAccessibleDescription, cons2);
		panel1.add(panelAccessibleDescription);
		
		
	}
	
	public void crearPanelAbajo(){
		
		adjuntar = Util.BotonImagen("añadir", "");
		adjuntar.setPreferredSize(new Dimension(150,50));
		adjuntar.setBackground(Color.lightGray);
		adjuntar.addActionListener(new AccionAdjuntarAccesibilidad(this));
		panel2.setPreferredSize(new Dimension(500,100));
		//panel2.add(adjuntar);
		
	}

	public PaginaAspectoBoton get_frame() {
		return _frame;
	}

	public void set_frame(PaginaAspectoBoton frame) {
		_frame = frame;
	}

	public JEditorPane getPanelAccessibleName() {
		return panelAccessibleName;
	}

	public void setPanelAccessibleName(JEditorPane panelAccessibleName) {
		this.panelAccessibleName = panelAccessibleName;
	}

	public JEditorPane getPanelAccessibleDescription() {
		return panelAccessibleDescription;
	}

	public void setPanelAccessibleDescription(JEditorPane panelAccessibleDescription) {
		this.panelAccessibleDescription = panelAccessibleDescription;
	}

		
}
